package com.edushare.common.dao;

import java.util.ArrayList;
import java.util.List;

import com.edushare.common.orm.ORMInterface;
import com.edushare.common.vo.Courses;
import com.edushare.common.vo.PrerequisiteLink;

public class PrerequisitesDAO extends CayenneBasedDAO {

	public PrerequisitesDAO(ORMInterface ormInterface) {
		super(ormInterface);
	}
	
	public List<Courses> getPrerequisites(Courses course){
		List<PrerequisiteLink> pLinks = course.getPrerequisiteLink();
		List<Courses> courseList = new ArrayList<Courses>();
		for(PrerequisiteLink p:pLinks){
			courseList.add(p.getPrerequisite());
		}
		return courseList;
	}

	public int getPrerequisiteCondition(Courses course){
		return course.getPrerequisitesCondition();
	}
	
	
}
